﻿@model SoftHotel.Models.ReservaEv

@{
    ViewBag.Title = "Search";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
  <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
 <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>
   <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>    
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>

<script type="text/javascript">
    var linkObj;
    $(function () {
        $(".busqueda").button();

        $('#searchDialog').dialog({
            autoOpen: false,
            width: 900,
            resizable: false,
            modal: true
            //            buttons: {
            //                
            //                "Cancel": function () {
            //                    $(this).dialog("close");
            //                }
            //            }
        });

        $(".busqueda").click(function () {
            //change the title of the dialgo
            linkObj = $(this);
            var dialogDiv = $('#searchDialog');
            var viewUrl = linkObj.attr('href');
            $.get(viewUrl, function (data) {
                dialogDiv.html(data);

                //open dialog
                dialogDiv.dialog('open');
            });
            return false;
        });

    });


    function searchSuccess() {
        var id = $("#update-message").html();
        //we update the table's info
        var parent = linkObj.closest("tr");
        document.getElementById('cliente').value = $("#idCliente" + id.toString()).val();



        //now we can close the dialog
        $('#searchDialog').dialog('close');
        //twitter type notification


    }
    
</script>



 <div id="searchDialog" title="Seleccionar Cliente"></div>
   

<h1><strong>Reserva de Eventos</strong></h1>
 <h2>
    Agregar<hr align="left" width="80" noshade="noshade" />   
 </h2>
 <br />
 @using (Html.BeginForm("Create", "ReservaEv", FormMethod.Get))
 {    <input type="submit" name="Agregar" value="Agregar" style = " margin-left : 100px;" />
 }


@using (Html.BeginForm()) {

        <h2>
        Buscar<hr align="left" width="80" noshade="noshade" />   
    </h2>
    <table id="MainContent_Table1" rules="none" style="border-color: Black; width: 450px; margin-bottom: 0px;">
	<tbody>
	<tr>
		<td style="width: 20px;"></td>
		<td style="font-weight: bold; width: 220px;" align="">Cliente</td>
		<td style="width: 220px;">		
       
         @Html.TextBoxFor(model => model.cliente )
           @Html.ValidationMessageFor(model => model.cliente)
            <!--//aqui todo!-->

           <a class="busqueda" href="/ReservaEv/BuscarCliente"> <img src="/Content/Images/buscar.png" alt="0" title="Buscar" id="" border="0" height="16" width="16"/></a>            </td>
	</tr>
	<tr>
		<td style="width: 20px;"></td>
		<td style="font-weight: bold; width: 220px;">Fecha de reserva </td>
		<td style="width: 220px;">
		@Html.TextBoxFor(model => model.fechaCreacion)
		</td>		
	</tr>
	<tr>
		<td style="width: 20px;"></td>
		<td style="font-weight: bold; width: 123px;">Numero de reserva </td>
		<td style="width: 194px;">@Html.TextBoxFor(model => model.numeroReserva)
        </td>
		<td></td>
	</tr>
	<tr>
		<td style="width: 20px;"></td>
		<td style="font-weight: bold; width: 123px;">Estado </td>
		<td><div>
        	 
             @Html.DropDownListFor(model => model.nomEstado, new[]{
                new SelectListItem { Value = "5", Text = "--Seleccione--" },
                new SelectListItem { Value = "0", Text = "Reservada" },
                new SelectListItem { Value = "1", Text = "Confirmada" },
                new SelectListItem { Value = "2", Text = "Iniciada" },
                new SelectListItem { Value = "3", Text = "Finalizada" },
                new SelectListItem { Value = "4", Text = "Anulada" }
                
                    })
		</div></td>
	</tr>

</tbody>
</table>
<br />
    
    <p>
<input value="Buscar" type="submit" name = "button" style = " margin-left : 100px;"/>
</p>
}

